﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/Core.Master" AutoEventWireup="true"
    CodeBehind="RoleDetails.aspx.cs" Title="<%$Resources:PageTitle %>" Inherits="Pap.Web.Modules.Membership.Views.RoleDetails" %>

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript">
        function CheckRoleNameExist(v, e) {
            Pap.ValidateRoleName();
        }
    </script>

    <ext:FitLayout runat="server">
        <ext:FormPanel ID="MainForm" runat="server" Frame="True" Title="Add new role" Border="true"
            BodyStyle="padding:10px 10px 0;" AutoScroll="true" meta:resourcekey="MainFormResource1">
            <Defaults>
                <ext:Parameter Name="Anchor" Value="95%" />
                <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
                <ext:Parameter Name="SelectOnFocus" Value="true" Mode="Raw" />
            </Defaults>
            <Body>
                <ext:FormLayout ID="FormLayoutDetails" runat="server" meta:resourcekey="FormLayoutDetailsResource1">
                    <ext:Anchor Horizontal="70%">
                        <ext:TextField ID="txtRoleName" FieldLabel="Name" runat="server" BlankText="Enter the Role's Name"
                            meta:resourcekey="txtRoleNameResource1" MaxLength="50">
                        </ext:TextField>
                    </ext:Anchor>
                    <ext:Anchor Horizontal="70%" Vertical="100%">
                        <ext:Panel ID="pnlPermissions" Frame="true" Title="Permissions" runat="server" AutoHeight="True"
                            AutoScroll="true" meta:resourcekey="pnlPermissionsResource1">
                            <Body>
                                <asp:DataList runat="server" ID="lstPermissions" RepeatColumns="3" RepeatDirection="Horizontal"
                                    Width="100%" Height="100%">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="txtID" runat="server" Value='<%# Eval("PermissionID") %>' />
                                        <ext:Checkbox ID="chkSelect" runat="server" BoxLabel='<%# Eval("PermissionArabicName") %>' />
                                    </ItemTemplate>
                                </asp:DataList>
                            </Body>
                        </ext:Panel>
                    </ext:Anchor>
                </ext:FormLayout>
                <asp:CustomValidator runat="server" ControlToValidate="txtRoleName" OnServerValidate="txtRoleName_Validate"
                    ClientValidationFunction="CheckRoleNameExist" />
                <asp:CustomValidator runat="server" OnServerValidate="lstPermissions_Validate" />
            </Body>
            <BottomBar>
                <ext:StatusBar ID="FormStatusBar" runat="server" DefaultText="Ready" meta:resourcekey="FormStatusBarResource1">
                    <Plugins>
                        <ext:ValidationStatus ID="pnlValidation" FormPanelID="MainForm" ErrorIcon="Exclamation"
                            meta:resourcekey="pnlValidationResource1" />
                    </Plugins>
                    <Items>
                        <ext:Button ID="btnCancel" Text="Cancel" runat="server" Icon="Cancel" meta:resourcekey="btnCencelResource1">
                            <AjaxEvents>
                                <Click OnEvent="btnCancel_Clicked" />
                            </AjaxEvents>
                        </ext:Button>
                        <quadz:CoolitePermitButton ID="btnSubmit" Text="Submit" runat="server" Icon="Disk"
                            meta:resourcekey="btnSubmitResource1" PermissionName="AddEditRole" HideAsDisabled="true">
                            <AjaxEvents>
                                <Click OnEvent="btnSubmit_Clicked" Before="var valid= #{MainForm}.getForm().isValid(); return valid;" />
                            </AjaxEvents>
                        </quadz:CoolitePermitButton>
                    </Items>
                </ext:StatusBar>
            </BottomBar>
        </ext:FormPanel>
    </ext:FitLayout>
</asp:Content>
